home *** CD-ROM | disk | FTP | other *** search
- #include "owlctrl.h"
-
- TOWLDelphiControl::TOWLDelphiControl()
- {
- InsertOWLControl(NULL);
- };
-
- void TOWLDelphiControl::InsertOWLControl(TWindow *IControl)
- {
- InternalControl = IControl;
- FDispatchEvent.Code = NULL;
- };
-
- unsigned long TOWLDelphiControl::DoDispatch(uint Msg, WPARAM wp, LPARAM lp)
- {
- if (FDispatchEvent.Code != NULL)
- ((TDispatchEvent)FDispatchEvent.Code)(FDispatchEvent.Self, Msg, wp, lp );
- return 0;
- };
-
- TOWLDelphiControl::~TOWLDelphiControl()
- {
- if (InternalControl != NULL)
- delete InternalControl;
- InternalControl = NULL;
- };
-
- void TOWLDelphiControl::DoNotifyEvent(TEvent AnEvent)
- {
- if (AnEvent.Code != NULL)
- ((TCPPNotifyEvent)AnEvent.Code)(AnEvent.Self,(const void *)this);
- };
-
- void TOWLDelphiControl::SetOnMessage(TEvent func)
- {
- FDispatchEvent = func;
- };
-
- void TOWLDelphiControl::SetVisible(bool aValue)
- {
- if (InternalControl != NULL)
- {
- if (!InternalControl->IsWindow())
- InternalControl->Create();
-
- if (aValue)
- InternalControl->Show(SW_SHOW);
- else
- InternalControl->Show(SW_HIDE);
- }
- }
-
- bool TOWLDelphiControl::GetVisible()
- {
- if (InternalControl != NULL)
- return (bool) InternalControl->IsWindowVisible();
- return false;
- }
-
- void TOWLDelphiControl::SetEnabled(bool avalue)
- {
- if (InternalControl != NULL)
- InternalControl->EnableWindow(avalue);
- }
-
- bool TOWLDelphiControl::GetEnabled()
- {
- if (InternalControl != NULL)
- InternalControl->IsWindowEnabled();
- return false;
- }
-
- void TOWLDelphiControl::BringToFront()
- {
- if (InternalControl != NULL)
- InternalControl->BringWindowToTop();
- }
-
- TPoint TOWLDelphiControl::ClientToScreen( TPoint pt )
- {
- if (InternalControl != NULL)
- InternalControl->ClientToScreen( pt );
- return pt;
- }
-
- int TOWLDelphiControl::GetTextBuf( LPSTR Buff, int Len )
- {
- if (InternalControl != NULL)
- return InternalControl->GetWindowText( Buff, Len );
- else
- return 0;
- }
-
- int TOWLDelphiControl::GetTextLen()
- {
- if (InternalControl != NULL)
- return InternalControl->GetWindowTextLength();
- else
- return 0;
- }
-
- void TOWLDelphiControl::Hide()
- {
- if (InternalControl != NULL)
- InternalControl->Show( SW_HIDE );
- }
-
- void TOWLDelphiControl::Invalidate()
- {
- if (InternalControl != NULL)
- InternalControl->Invalidate( true );
- }
-
- void TOWLDelphiControl::Refresh()
- {
- if (InternalControl != NULL)
- {
- InternalControl->Invalidate( true );
- InternalControl->UpdateWindow();
- }
- }
-
- void TOWLDelphiControl::ScrollBy( int DeltaX, int DeltaY )
- {
- if (InternalControl != NULL)
- InternalControl->ScrollWindow( DeltaX, DeltaY );
- }
-
- void TOWLDelphiControl::Repaint()
- {
- if (InternalControl != NULL)
- InternalControl->Invalidate( false );
- }
-
- TPoint TOWLDelphiControl::ScreenToClient( TPoint pt )
- {
- if (InternalControl != NULL)
- InternalControl->ScreenToClient( pt );
- return pt;
- }
-
- void TOWLDelphiControl::SendToBack()
- {
- if (InternalControl != NULL)
- InternalControl->SetWindowPos( HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
- }
-
- void TOWLDelphiControl::SetBounds( int l, int t, int w, int h )
- {
- if (InternalControl != NULL)
- InternalControl->SetWindowPos( NULL, l, t, w, h, SWP_NOZORDER );
- }
-
- void TOWLDelphiControl::SetTextBuf( LPCSTR lpsz )
- {
- if (InternalControl != NULL)
- InternalControl->SetWindowText( lpsz );
- }
-
- void TOWLDelphiControl::Show()
- {
- if (InternalControl != NULL)
- InternalControl->Show( SW_SHOW );
- }
-
- void TOWLDelphiControl::Update()
- {
- if (InternalControl != NULL)
- InternalControl->UpdateWindow();
- }
-